package com.demo1;

import com.demo1.Role;

public class RoleTest {
    public static void main(String[] args) {
        //1.创建第一个角色
        Role role1 = new Role("乔峰", 100);
        //2.创建第二个角色
        Role role2 = new Role("鸠摩智",100);
        //3.开始格斗 回合制游戏
        while (true){
            //role1攻击role2
            role1.attack(role2);
            //判断role2的剩余血量
            if(role2.getBlood()==0){
                System.out.println(role1.getName()+"KO"+role2.getName());
                break;
            }
            //role2攻击role1
            role2.attack(role1);
            //判断role2的剩余血量
            if(role1.getBlood()==0){
                System.out.println(role2.getName()+"KO"+role1.getName());
                break;
            }
            System.out.println("---------");
        }
    }
}
